import { defineStore } from "pinia";
import { store } from "@/store";

// 当前模块的所有角色路由
export const RoleMenu = defineStore({
  id: "RoleMenu",
  state: () => ({
    menu: []
  }),

  actions: {
    SETROLEMENU(data) {
      this.menu = data;
      localStorage.setItem("RoleMenu", JSON.stringify(this.menu));
      console.log("存储角色路由", this.menu);
    },
    DELETEMENUMS(data) {
      this.menu = [];
      localStorage.removeItem("RoleMenu");
      console.log("删除角色路由", this.menu);
    }
  }
});

export function useUserStoreHook() {
  return RoleMenu(store);
}
